/**
 * ------------------------------------------------------
 *  封装获取班级列表的逻辑
 * ------------------------------------------------------
 *
 * Note: .
 *
 */

import {useState,useEffect} from 'react'
import {getClassesAPI} from '@/apis/student'

function useClasses(){
    //获取班级列表逻辑
    const [classesList, setClassesList] = useState([])
    useEffect(()=>{
        const getClassesList = async () =>{
          const res = await getClassesAPI()
          setClassesList(res.data.classes)
        }
        getClassesList()
      },[])
    //把组件中用到的数据return出去
    return {
      classesList
    }
}

export {useClasses}